home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1118 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.infi.net!usenet
  2. From: nngis@norfolk.infi.net (Greg DiGiorgio)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: printf - adding commas to numbers
  5. Date: 11 Jan 1996 15:42:45 GMT
  6. Organization: Customer of InfiNet
  7. Message-ID: <4d3b5l$fsm@news.infi.net>
  8. References: <4d15eq$lc5@ixnews2.ix.netcom.com>
  9. Reply-To: nngis@norfolk.infi.net
  10. NNTP-Posting-Host: h-langoliers.norfolk.infi.net
  11. Mime-Version: 1.0
  12. X-Newsreader: WinVN 0.99.3
  13.  
  14. In article <4d15eq$lc5@ixnews2.ix.netcom.com>, chuckh@ix.netcom.com 
  15. says...
  16. >
  17. >Is there a simple way with a printf format specifier to add commas to
  18. >an integer?
  19.  
  20. *** No. 
  21. >
  22. >For example, if the value of integer i is 12345 I want the output to
  23. >be:
  24. >
  25. >12,345.
  26.  
  27. *** I understand.
  28.  
  29. >
  30. >I know this can be done in a function but I'd think that printf ought
  31. >to have such capability since it's such a common output format.
  32.  
  33. *** That's correct, it can be done in a function. How often would you
  34. *** use it? For check writing, some financials, but not much else.
  35. *** Therefore, should "printf" which is big enough as it is, be changed
  36. *** to incorporate commas like BASIC's "Print Using" stmt? How about
  37. *** if I want to show currency in european format? Should "printf" do
  38. *** that as well? What if I want "12345" to print vertically, one number
  39. *** per line? Should print be able to do that?
  40. ***
  41. *** I think you can see my point. The line has to be drawn somewhere,
  42. *** else 'C' programs would be so big due to  intrinisic functions,
  43. *** that they would not fit well into embedded systems or small
  44. *** handhelds (weak argument I know given multi-megabyte RAM nowadays).
  45. >
  46. >Please respond via E-mail since I don't check this group often.
  47. >--
  48. >Chuck Hamilton
  49. >chuckh@ix.netcom.com
  50. >
  51. >If at first you don't succeed, skydiving isn't for you.
  52. >
  53.  
  54.